package com.chapter.sample.redis.controller;

import com.chapter.sample.redis.service.OrderService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@Slf4j
@RestController
public class OrderController {

    @Autowired
    OrderService orderService;

    @RequestMapping("/order/add")
    public void addOrder() {
        orderService.addOrder();
    }

    @RequestMapping("/order/{keyId}")
    public String getOrderById(@PathVariable("keyId") Integer keyId) {
        return orderService.getOrderById(keyId);
    }
}
